/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink: 链接地址不为空 2、isIframe:false`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，开启条件，`1、isIframe:true 2、isLink：链接地址不为空`
 *      roles：         当前路由权限标识，取角色管理。控制路由显示、隐藏。超级管理员：admin 普通角色：common
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 定义动态路由
 * @description 未开启 isRequestRoutes 为 true 时使用（前端控制路由），开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
 * @returns 返回路由菜单数据
 */
export const dynamicRoutes = [
	{
		path: '/',
		name: '/',
		component: () => import('/@/layout/index.vue'),
		redirect: '/home',
		meta: {
			isKeepAlive: true,
		},
		children: [
			{
				path: '/home',
				name: '首页',
				component: () => import('/@/views/home/index.vue'),
				meta: {
					title: '首页',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'common', 'superAdmin', 'expert'],
					icon: 'iconfont icon-shouye',
				},
			},
			/*{
				path: '',
				name: '数据大屏',
				//component: () => import('/@/views/home/index.vue'),
				meta: {
					title: '数据大屏',
					isLink: 'http://175.178.248.137/',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: true,
					roles: ['admin', 'common', 'superAdmin', 'expert'],
					icon: 'iconfont icon-diannao1',
				},
			},*/
			{
				path: '/system',
				name: '人员管理',
				component: () => import('/@/system/user'),
				redirect: '/system',
				meta: {
					title: '人员管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'superAdmin'],
					icon: 'ele-Avatar',
				},
				children: [
					{
						path: '/system/user',
						name: '用户管理',
						component: () => import('/@/views/system/user/index.vue'),
						meta: {
							title: '用户管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'iconfont icon-icon-',
						},
					},
					{
						path: '/system/role',
						name: '角色管理',
						component: () => import('/@/views/system/role/index.vue'),
						meta: {
							title: '角色管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'iconfont icon-shuxingtu',
						},
					},
					{
						path: '/system/permission',
						name: '权限管理',
						component: () => import('/@/views/system/permission/index.vue'),
						meta: {
							title: '权限管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'iconfont icon-quanxian',
						},
					},
					{
						path: '/system/userRole',
						name: '用户角色管理',
						component: () => import('/@/views/system/userRole/index.vue'),
						meta: {
							title: '用户角色管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['superAdmin'],
							icon: 'ele-Coordinate',
						},
					},
					{
						path: '/system/rolePermission',
						name: '角色权限管理',
						component: () => import('/@/views/system/rolePermission/index.vue'),
						meta: {
							title: '角色权限管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['superAdmin'],
							icon: 'ele-Key',
						},
					},
				],
			},
			{
				path: '/data',
				name: '数据管理',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/data',
				meta: {
					title: '数据管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'superAdmin'],
					icon: 'fa fa-database',
				},
				children: [
					{
						path: '/data/bingchonghai',
						name: '病虫害数据',
						component: () => import('/@/views/data/bingchonghai'),
						meta: {
							title: '病虫害数据',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'fa fa-bug',
						},
						children: [
							{
								path: '/data/bingchonghai/info',
								name: '病虫害信息',
								component: () => import('/@/views/data/bingchonghai/info.vue'),
								meta: {
									title: '病虫害信息',
									isLink: '',
									isHide: false,
									isKeepAlive: true,
									isAffix: false,
									isIframe: false,
									roles: ['admin', 'superAdmin'],
									icon: 'fa fa-stethoscope',
								},
							},
							{
								path: '/data/bingchonghai/loss',
								name: '损失数据',
								component: () => import('/@/views/data/bingchonghai/loss.vue'),
								meta: {
									title: '损失数据',
									isLink: '',
									isHide: false,
									isKeepAlive: true,
									isAffix: false,
									isIframe: false,
									roles: ['admin', 'superAdmin'],
									icon: 'fa fa-crosshairs',
								},
							},
						]
					},
					{
						path: '/data/crop',
						name: '作物数据',
						component: () => import('/@/views/data/crop/produce.vue'),
						meta: {
							title: '作物数据',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'fa fa-tree',
						},
						children: [
							{
								path: '/data/crop/produce',
								name: '作物产量',
								component: () => import('/@/views/data/crop/produce.vue'),
								meta: {
									title: '作物产量',
									isLink: '',
									isHide: false,
									isKeepAlive: true,
									isAffix: false,
									isIframe: false,
									roles: ['admin', 'superAdmin'],
									icon: 'fa fa-truck',
								},
							},
							{
								path: '/data/crop/news',
								name: '作物新闻',
								component: () => import('/@/views/data/crop/news.vue'),
								meta: {
									title: '作物新闻',
									isLink: '',
									isHide: false,
									isKeepAlive: true,
									isAffix: false,
									isIframe: false,
									roles: ['admin', 'superAdmin'],
									icon: 'fa fa-comment-o',
								},
							},
						]
					},
					{
						path: '/data/price',
						name: '价格数据',
						component: () => import('/@/views/data/price/index.vue'),
						meta: {
							title: '价格数据',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'ele-PriceTag',
						},
					},
				],
			},
			/*{
				path: '/forum',
				name: '论坛管理',
				component: () => import('/@/forum'),
				redirect: '/system',
				meta: {
					title: '论坛管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'superAdmin'],
					icon: 'iconfont icon-xingqiu',
				},
				children: [
					{
						path: '/forum/post',
						name: '帖子管理',
						component: () => import('/@/views/forum/post/index.vue'),
						meta: {
							title: '帖子管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'iconfont icon-fuwenbenkuang',
						},
					},
					{
						path: '/forum/comment',
						name: '评论管理',
						component: () => import('/@/views/forum/comment/index.vue'),
						meta: {
							title: '评论管理',
							isLink: '',
							isHide: false,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'superAdmin'],
							icon: 'ele-EditPen',
						},
					},
				],
			},*/
			{
				path: '/system/manager',
				name: '数据更新',
				component: () => import('/@/views/system/manager/index.vue'),
				meta: {
					title: '数据更新',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'superAdmin'],
					icon: 'iconfont icon-xitongshezhi',
				},
			},/*
			{
				path: '/dataAnalysis',
				name: '数据分析',
				component: () => import('/@/views/dataAnalysis/index.vue'),
				meta: {
					title: '数据分析',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'superAdmin'],
					icon: 'iconfont icon-putong',
				},
			},
			{
				path: '/own',
				name: '个人中心',
				component: () => import('/@/views/own/index.vue'),
				meta: {
					title: '个人中心',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'common', 'superAdmin', 'expert'],
					icon: 'fa fa-user',
				},
			},
			{
				path: '/us',
				name: '关于我们',
				component: () => import('/@/views/us/index.vue'),
				meta: {
					title: '关于我们',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'common', 'superAdmin', 'expert'],
					icon: 'fa fa-user-secret',
				},
			},
			/*{
				path: '/more',
				name: 'more',
				component: () => import('/@/views/more/index.vue'),
				meta: {
					title: '聊天室',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					roles: ['admin', 'common', 'superAdmin', 'expert'],
					icon: 'ele-Menu',
				},
			},*/
		],
	},
];

/**
 * 定义404、401界面
 * @link 参考：https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
 */
export const notFoundAndNoPower = [
	{
		path: '/:path(.*)*',
		name: 'notFound',
		component: () => import('/@/views/error/404.vue'),
		meta: {
			title: '页面找不到',
			isHide: true,
		},
	},
	{
		path: '/401',
		name: 'noPower',
		component: () => import('/@/views/error/401.vue'),
		meta: {
			title: '页面无权限',
			isHide: true,
		},
	},
];

/**
 * 定义静态路由（默认路由）
 * 此路由不要动，前端添加路由的话，请在 `dynamicRoutes 数组` 中添加
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const staticRoutes = [
	{
		path: '/login',
		name: 'login',
		component: () => import('/@/views/login/index.vue'),
		meta: {
			title: '登录',
		},
	},
];
